package com.syh.jn.scm.domain.supplier.entity.logistics;

import cn.redscarf.commons.util.bean.ExtBeanUtils;
import cn.redscarf.commons.util.other.ExtAssert;
import cn.redscarf.commons.util.validator.ValidationUtils;
import com.syh.jn.scm.dto.supplier.logistics.LogisticsBillMto;
import com.syh.jn.scm.dto.supplier.logistics.LogisticsBillSto;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * Created by soci.song on 2018/11/2.
 */
@Data
@NoArgsConstructor
public class LogisticsBillItem implements Serializable {
  /**
   * id
   */
  protected Long id;
  /**
   * 对应订单ITEMId
   */
  private Long orderItemId;
  /**
   * 订单类型
   */
  private Short orderType;
  /**
   * 物流单ID
   */
  private Long logisticsBillId;
  /**
   * 商品id
   */
  private Long goodsId;
  /**
   * 商品编码
   */
  private String goodsCode;
  /**
   * 商品名称
   */
  private String goodsName;
  /**
   * 商品数量
   */
  private BigDecimal quantity;
  /**
   * 单位
   */
  private String units;

  public LogisticsBillItem(LogisticsBillSto.LogisticsBillItemSto itemSto) {
    ExtAssert.notNull(itemSto, "明细新增对象为空");
    ValidationUtils.validate(itemSto);
    ExtBeanUtils.copyProperties(itemSto, this);
  }

  public LogisticsBillItem(LogisticsBillMto.LogisticsBillItemMto itemMto) {
    ExtAssert.notNull(itemMto, "明细编辑对象为空");
    ValidationUtils.validate(itemMto);
    ExtBeanUtils.copyProperties(itemMto, this);
  }
}
